home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume13 / xfig2.9 / patch10.04 < prev    next >
Encoding:
Internet Message Format  |  1991-07-05  |  55.7 KB

  1. Path: uunet!olivea!oliveb!veritas!amdcad!sun!exodus!bea.lbl.gov
  2. From: envbvs@bea.lbl.gov (Brian V. Smith)
  3. Newsgroups: comp.sources.x
  4. Subject: v13i071: xfig2, Patch10, Part04/04
  5. Message-ID: <16334@exodus.Eng.Sun.COM>
  6. Date: 6 Jul 91 06:59:41 GMT
  7. References: <csx-13i068-xfig2.9@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 1952
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: envbvs@bea.lbl.gov (Brian V. Smith)
  13. Posting-number: Volume 13, Issue 71
  14. Archive-name: xfig2.9/patch10.04
  15. Patch-To: xfig2.9: Volume 8, Issue 10-30
  16. Patch-To: xfig2.9: Volume 10, Issue 26-31
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 4 (of 4)."
  25. # Contents:  patch10.4
  26. # Wrapped by envbvs@bea.lbl.gov.lbl.gov on Fri Jun 14 14:37:06 1991
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'patch10.4' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'patch10.4'\"
  30. else
  31. echo shar: Extracting \"'patch10.4'\" \(53127 characters\)
  32. sed "s/^X//" >'patch10.4' <<'END_OF_FILE'
  33. X*** @xfig.pl9/save.c    Mon Jun 25 11:25:47 1990
  34. X--- ./save.c    Mon Jun  3 11:15:45 1991
  35. X***************
  36. X*** 17,30 ****
  37. X  extern F_compound    objects;
  38. X  
  39. X  extern int        figure_modified;
  40. X! extern int        errno;
  41. X! 
  42. X  extern             null_proc();
  43. X  
  44. X- extern char        *sys_errlist[];
  45. X- extern int        sys_nerr, errno;
  46. X- extern int        num_object;
  47. X- 
  48. X  write_file(file_name, prompt)
  49. X  char    *file_name;
  50. X  int    prompt;
  51. X--- 17,25 ----
  52. X  extern F_compound    objects;
  53. X  
  54. X  extern int        figure_modified;
  55. X! extern int        num_object;
  56. X  extern             null_proc();
  57. X  
  58. X  write_file(file_name, prompt)
  59. X  char    *file_name;
  60. X  int    prompt;
  61. X***************
  62. X*** 71,83 ****
  63. X      else {
  64. X          figure_modified = 0;
  65. X          num_object = 0;
  66. X!         write_objects(fp);
  67. X          put_msg("%d objects saved in \"%s\"", num_object, file_name);
  68. X          return(0);
  69. X          }
  70. X      }
  71. X  
  72. X! write_objects(fp)
  73. X  FILE    *fp;
  74. X  {
  75. X      extern char    file_header[];
  76. X--- 66,82 ----
  77. X      else {
  78. X          figure_modified = 0;
  79. X          num_object = 0;
  80. X!         if (write_objects(fp))
  81. X!         { put_msg("Error writing file %s, %s",file_name, 
  82. X!               sys_errlist[errno]);
  83. X!           return(-1);
  84. X!         }
  85. X          put_msg("%d objects saved in \"%s\"", num_object, file_name);
  86. X          return(0);
  87. X          }
  88. X      }
  89. X  
  90. X! int write_objects(fp)
  91. X  FILE    *fp;
  92. X  {
  93. X      extern char    file_header[];
  94. X***************
  95. X*** 118,124 ****
  96. X          num_object++;
  97. X          write_text(fp, t);
  98. X          }
  99. X!     fclose(fp);
  100. X      }
  101. X  
  102. X  write_arc(fp, a)
  103. X--- 117,125 ----
  104. X          num_object++;
  105. X          write_text(fp, t);
  106. X          }
  107. X!     if (ferror(fp)) { fclose(fp); return(-1); }
  108. X!     if (fclose(fp)==EOF) return(-1);
  109. X!     return(0);
  110. X      }
  111. X  
  112. X  write_arc(fp, a)
  113. X*** @xfig.pl9/search.c    Tue Mar  6 09:09:23 1990
  114. X--- ./search.c    Tue Jun 11 15:12:26 1991
  115. X***************
  116. X*** 10,16 ****
  117. X--- 10,588 ----
  118. X  #include "fig.h"
  119. X  #include "object.h"
  120. X  
  121. X+ #define TOLERANCE 3
  122. X+ 
  123. X  extern F_compound    objects;
  124. X+ 
  125. X+ static (*manipulate)();
  126. X+ static (*handlerproc_left)();
  127. X+ static (*handlerproc_middle)();
  128. X+ static int type;
  129. X+ static char *p;
  130. X+ static char objectmarker_shown;
  131. X+ static long objectcount;
  132. X+ static long n;
  133. X+ 
  134. X+ static F_point point1, point2;
  135. X+ 
  136. X+ static F_arc *a;
  137. X+ static F_ellipse *e;
  138. X+ static F_line *l;
  139. X+ static F_spline *s;
  140. X+ static F_text *t;
  141. X+ static F_compound *c;
  142. X+ 
  143. X+ char next_arc_found(x, y, tolerance, px, py,shift)
  144. X+ int    x, y, tolerance, *px, *py;
  145. X+ int shift;
  146. X+ {    /*    (px, py) is the control point on the circumference of an arc
  147. X+         which is the closest to (x, y)                */
  148. X+ 
  149. X+     int    i;
  150. X+ 
  151. X+     if (a==NULL) 
  152. X+       a=objects.arcs; 
  153. X+     else if (shift) a=a->next;
  154. X+ 
  155. X+     for (; a != NULL; a = a->next,n++) {
  156. X+         for (i = 0; i < 3; i++) 
  157. X+         if ((abs(a->point[i].x - x) <= tolerance) && 
  158. X+             (abs(a->point[i].y - y) <= tolerance)) {
  159. X+             *px = a->point[i].x;
  160. X+             *py = a->point[i].y;
  161. X+             return(1);
  162. X+             }
  163. X+         }
  164. X+     return(0);
  165. X+     }
  166. X+ 
  167. X+ 
  168. X+ #define min(a,b) ((a) < (b) ? (a) : (b))
  169. X+ 
  170. X+ char next_ellipse_found(x, y, tolerance, px, py,shift)
  171. X+ int    x, y, tolerance, *px, *py;
  172. X+ int shift;
  173. X+ {    /*    (px, py) is the point on the circumference of an ellipse
  174. X+         which is the closest to (x, y)                */
  175. X+ 
  176. X+     int        a, b, dx, dy;
  177. X+     float        dis, r, tol;
  178. X+ 
  179. X+     if (e==NULL) 
  180. X+       e=objects.ellipses; 
  181. X+     else if (shift) e=e->next;
  182. X+ 
  183. X+     tol = (float) tolerance;
  184. X+     for (; e != NULL; e = e->next,n++) {
  185. X+         dx = x - e->center.x;
  186. X+         dy = y - e->center.y;
  187. X+         a = e->radiuses.x;
  188. X+         b = e->radiuses.y;
  189. X+         /* prevent sqrt(0) core dumps */
  190. X+         if(dx == 0 && dy == 0)
  191. X+         dis = 0;    /* so we return below */
  192. X+         else
  193. X+             dis = sqrt((double)(dx*dx + dy*dy));
  194. X+          if (dis == 0) {
  195. X+          *px = e->center.x;
  196. X+          *py = e->center.y;
  197. X+          return(1);
  198. X+          }
  199. X+         if(a * dy == 0 && b * dx == 0)
  200. X+         r = 0;  /* prevent core dumps */
  201. X+         else r = a * b * dis / sqrt((double) (1.0*b*b*dx*dx + 1.0*a*a*dy*dy));
  202. X+         if (fabs(dis - r) <= tol) {
  203. X+         *px = (int)(r*dx/dis + ((dx < 0) ? -.5 : .5)) + e->center.x;
  204. X+         *py = (int)(r*dy/dis + ((dy < 0) ? -.5 : .5)) + e->center.y;
  205. X+         return(1);
  206. X+         }
  207. X+         }
  208. X+     return(0);
  209. X+     }
  210. X+ 
  211. X+ char next_line_found(x, y, tolerance, px, py, shift)
  212. X+ int    x, y, tolerance, *px, *py, shift;
  213. X+ {    /*return the pointer to lines object if the search is successful
  214. X+       otherwise return NULL.  
  215. X+       The value returned via (px, py) is the closest point on the 
  216. X+       vector to point (x, y)                     */
  217. X+  
  218. X+     F_line    *lines;
  219. X+     F_point    *point;
  220. X+     int    x1, y1, x2, y2;
  221. X+     float    tol2;
  222. X+ 
  223. X+     tol2 = (float) tolerance * tolerance;
  224. X+ 
  225. X+     if (l==NULL) 
  226. X+       l=objects.lines; 
  227. X+     else if (shift) l=l->next;
  228. X+ 
  229. X+     for (; l!= NULL; l= l->next,n++) {
  230. X+         point = l->points;
  231. X+         x1 = point->x;
  232. X+         y1 = point->y;
  233. X+         if (abs(x - x1) <= tolerance && abs(y - y1) <= tolerance) {
  234. X+         *px = x1;  *py = y1;
  235. X+         return(1);
  236. X+         }
  237. X+         for (point = point->next; point != NULL; point = point->next) {
  238. X+         x2 = point->x;
  239. X+         y2 = point->y;
  240. X+         if (close_to_vector(x1, y1, x2, y2, x, y, tolerance, tol2, 
  241. X+                     px, py)) 
  242. X+             return(1);
  243. X+         x1 = x2;
  244. X+         y1 = y2;
  245. X+         }
  246. X+         }
  247. X+     return(0);
  248. X+     }
  249. X+ 
  250. X+ char next_spline_found(x, y, tolerance, px, py,shift)
  251. X+ int    x, y, tolerance, *px, *py;
  252. X+ int shift;
  253. X+ {    /*    return the pointer to lines object if the search is successful
  254. X+         otherwise return NULL.  */
  255. X+  
  256. X+     F_point        *point;
  257. X+     int        x1, y1, x2, y2;
  258. X+     float        tol2;
  259. X+ 
  260. X+     if (s==NULL) 
  261. X+       s=objects.splines; 
  262. X+     else if (shift) s=s->next;
  263. X+ 
  264. X+     tol2 = (float) tolerance * tolerance;
  265. X+     for (; s!= NULL; s= s->next,n++) {
  266. X+         point = s->points;
  267. X+         x1 = point->x;
  268. X+         y1 = point->y;
  269. X+         for (point = point->next; point != NULL; point = point->next) {
  270. X+         x2 = point->x;
  271. X+         y2 = point->y;
  272. X+         if (close_to_vector(x1, y1, x2, y2, x, y, tolerance, tol2,
  273. X+                     px, py)) 
  274. X+             return(1);
  275. X+         x1 = x2;
  276. X+         y1 = y2;
  277. X+         }
  278. X+         }
  279. X+     return(0);
  280. X+     }
  281. X+ 
  282. X+ char next_text_found(x, y, dummy1, dummy2, dummy3, shift)
  283. X+ int    x, y;
  284. X+ int dummy1, dummy2, dummy3, shift;
  285. X+ {
  286. X+     int    halflen;
  287. X+ 
  288. X+     if (t==NULL) 
  289. X+       t=objects.texts; 
  290. X+     else if (shift) t=t->next;
  291. X+ 
  292. X+     for (; t != NULL; t = t->next,n++) {
  293. X+         halflen = t->length/2;
  294. X+         if (t->base_y - t->height > y) 
  295. X+         continue;
  296. X+         if (t->base_y < y) 
  297. X+         continue;
  298. X+         if ( ((t->type == T_LEFT_JUSTIFIED) && t->base_x > x) ||
  299. X+             ((t->type == T_CENTER_JUSTIFIED) && t->base_x - halflen > x) ||
  300. X+             ((t->type == T_RIGHT_JUSTIFIED) && t->base_x - t->length > x) )
  301. X+             continue;
  302. X+         if ( ((t->type == T_LEFT_JUSTIFIED) && t->base_x + t->length < x) ||
  303. X+             ((t->type == T_CENTER_JUSTIFIED) && t->base_x + halflen < x) ||
  304. X+             ((t->type == T_RIGHT_JUSTIFIED) && t->base_x < x) )
  305. X+             continue;
  306. X+         return(1);
  307. X+         }
  308. X+     return(0);
  309. X+     }
  310. X+       
  311. X+ int next_compound_found(x, y, tolerance, px, py,shift)
  312. X+ int    x, y, tolerance, *px, *py;
  313. X+ int shift;
  314. X+ {
  315. X+     float        tol2;
  316. X+ 
  317. X+     if (c==NULL) 
  318. X+       c=objects.compounds; 
  319. X+     else if (shift) c=c->next;
  320. X+ 
  321. X+     tol2 = tolerance * tolerance;
  322. X+     
  323. X+     for (; c != NULL; c = c->next,n++) {
  324. X+         if (close_to_vector(c->nwcorner.x, c->nwcorner.y, c->nwcorner.x,
  325. X+             c->secorner.y, x, y, tolerance, tol2, px, py)) 
  326. X+         return(1);
  327. X+         if (close_to_vector(c->secorner.x, c->secorner.y, c->nwcorner.x,
  328. X+             c->secorner.y, x, y, tolerance, tol2, px, py)) 
  329. X+         return(1);
  330. X+         if (close_to_vector(c->secorner.x, c->secorner.y, c->secorner.x,
  331. X+             c->nwcorner.y, x, y, tolerance, tol2, px, py)) 
  332. X+         return(1);
  333. X+         if (close_to_vector(c->nwcorner.x, c->nwcorner.y, c->secorner.x,
  334. X+             c->nwcorner.y, x, y, tolerance, tol2, px, py)) 
  335. X+         return(1);
  336. X+         }
  337. X+     return(0);
  338. X+     }
  339. X+ 
  340. X+ show_objectmarker()
  341. X+ {
  342. X+     if (objectmarker_shown) return;
  343. X+     objectmarker_shown=1;
  344. X+     erase_pointmarker();
  345. X+     toggle_objectmarker();
  346. X+ }
  347. X+ 
  348. X+ erase_objectmarker()
  349. X+ {
  350. X+     if (!objectmarker_shown) return;
  351. X+     objectmarker_shown=0;
  352. X+     erase_pointmarker();
  353. X+     toggle_objectmarker();
  354. X+ }
  355. X+ 
  356. X+ finish_objectmarker()
  357. X+ {
  358. X+     show_pointmarker();
  359. X+     if (!objectmarker_shown) return;
  360. X+     objectmarker_shown=0;
  361. X+     toggle_objectmarker();
  362. X+ }
  363. X+ 
  364. X+ toggle_objectmarker()
  365. X+ {
  366. X+     switch(type)
  367. X+     { case O_ELLIPSE: toggle_ellipsepointmarker(e);
  368. X+               break;
  369. X+       case O_POLYLINE: toggle_linepointmarker(l);
  370. X+                break;
  371. X+       case O_SPLINE: toggle_splinepointmarker(s);
  372. X+                break;
  373. X+       case O_TEXT: toggle_textpointmarker(t);
  374. X+                break;
  375. X+       case O_ARC: toggle_arcpointmarker(a);
  376. X+                break;
  377. X+       case O_COMPOUND: toggle_compoundpointmarker(c);
  378. X+                break;
  379. X+     }
  380. X+ }
  381. X+ 
  382. X+ void init_object_search(handlerproc)
  383. X+ int (*handlerproc)();
  384. X+ {
  385. X+     objectcount=0;
  386. X+     for (e=objects.ellipses;e!=NULL;e=e->next) objectcount++;
  387. X+     for (l=objects.lines;l!=NULL;l=l->next) objectcount++;
  388. X+     for (s=objects.splines;s!=NULL;s=s->next) objectcount++;
  389. X+     for (t=objects.texts;t!=NULL;t=t->next) objectcount++;
  390. X+     for (a=objects.arcs;a!=NULL;a=a->next) objectcount++;
  391. X+     for (c=objects.compounds;c!=NULL;c=c->next) objectcount++;
  392. X+     e=NULL;
  393. X+     type=O_ELLIPSE;
  394. X+     manipulate=handlerproc;
  395. X+     objectmarker_shown=0;
  396. X+     }
  397. X+ 
  398. X+ void object_search(x,y,shift)
  399. X+ int    x, y;
  400. X+ unsigned int shift;  /* Shift Key Status from XEvent */
  401. X+ {
  402. X+     int px,py;
  403. X+     char found=0;
  404. X+     erase_objectmarker();
  405. X+     for (n=0;n<objectcount;)
  406. X+     {
  407. X+         switch(type)
  408. X+         { case O_ELLIPSE: if (next_ellipse_found(x,y,TOLERANCE,&px,&py,shift))
  409. X+              { found=1;
  410. X+              }
  411. X+                break;
  412. X+           case O_POLYLINE: if (next_line_found(x,y,TOLERANCE,&px,&py,shift))
  413. X+              { found=1;
  414. X+              }
  415. X+                break;
  416. X+           case O_SPLINE: if (next_spline_found(x,y,TOLERANCE,&px,&py,shift))
  417. X+              { found=1;
  418. X+              }
  419. X+                break;
  420. X+           case O_TEXT: if (next_text_found(x,y,TOLERANCE,&px,&py,shift))
  421. X+              { found=1;
  422. X+              }
  423. X+                break;
  424. X+           case O_ARC: if (next_arc_found(x,y,TOLERANCE,&px,&py,shift))
  425. X+              { found=1;
  426. X+              }
  427. X+                break;
  428. X+           case O_COMPOUND: if (next_compound_found(x,y,TOLERANCE,&px,&py,shift))
  429. X+              { found=1;
  430. X+              }
  431. X+                break;
  432. X+         }
  433. X+         if (found) 
  434. X+         { if (! shift) break;
  435. X+           show_objectmarker();
  436. X+           found=0;
  437. X+           break;
  438. X+         }
  439. X+         switch(type)
  440. X+         { case O_ELLIPSE: type=O_POLYLINE;
  441. X+                   l=NULL;
  442. X+                   break;
  443. X+           case O_POLYLINE: type=O_SPLINE;
  444. X+                    s=NULL;
  445. X+                    break;
  446. X+           case O_SPLINE: type=O_TEXT;
  447. X+                  t=NULL;
  448. X+                  break;
  449. X+           case O_TEXT: type=O_ARC;
  450. X+                a=NULL;
  451. X+                break;
  452. X+           case O_ARC: type=O_COMPOUND;
  453. X+               c=NULL;
  454. X+               break; 
  455. X+           case O_COMPOUND: type=O_ELLIPSE;
  456. X+                    e=NULL;
  457. X+                    break;
  458. X+         }
  459. X+     }
  460. X+     if (found) 
  461. X+     { finish_objectmarker();
  462. X+       switch(type)
  463. X+       { case O_ELLIPSE: manipulate(e,type,x,y,px,py);
  464. X+                 break;
  465. X+         case O_POLYLINE: manipulate(l,type,x,y,px,py);
  466. X+                 break;
  467. X+         case O_SPLINE: manipulate(s,type,x,y,px,py);
  468. X+                 break;
  469. X+         case O_TEXT: manipulate(t,type,x,y,px,py);
  470. X+                 break;
  471. X+         case O_ARC: manipulate(a,type,x,y,px,py);
  472. X+                 break;
  473. X+         case O_COMPOUND: manipulate(c,type,x,y,px,py);
  474. X+                 break;
  475. X+       }
  476. X+       /* On next invocation, start searching from the start */
  477. X+       e=NULL;
  478. X+       type=O_ELLIPSE;
  479. X+     }
  480. X+ }
  481. X+ 
  482. X+ 
  483. X+ 
  484. X+ 
  485. X+ 
  486. X+ char next_ellipse_point_found(x, y, tol, point_num, shift )
  487. X+ int    x, y, tol, shift, *point_num;
  488. X+ {
  489. X+ 
  490. X+      if (e==NULL)
  491. X+        e=objects.ellipses;
  492. X+      else if (shift) e=e->next;
  493. X+ 
  494. X+ 
  495. X+     for (; e != NULL; e = e->next,n++) {
  496. X+         if (abs(e->start.x - x) <= tol && abs(e->start.y - y) <= tol) {
  497. X+         *point_num = 0;
  498. X+         return(1);
  499. X+         }
  500. X+         if (abs(e->end.x - x) <= tol && abs(e->end.y - y) <= tol) {
  501. X+         *point_num = 1;
  502. X+         return(1);
  503. X+         }
  504. X+         }
  505. X+     return(0);
  506. X+     }
  507. X+ 
  508. X+ 
  509. X+ static F_arc        *cur_a;
  510. X+ 
  511. X+ char next_arc_point_found(x, y, tol, point_num, shift)
  512. X+ int    x, y, tol, shift, *point_num;
  513. X+ {
  514. X+     int    i;
  515. X+ 
  516. X+     if (a==NULL)
  517. X+           a=objects.arcs;
  518. X+         else if (shift) a=a->next;
  519. X+ 
  520. X+     for(; a != NULL; a = a->next,n++) {
  521. X+         for (i = 0; i < 3; i++) {
  522. X+         if (abs(a->point[i].x - x) <= tol && 
  523. X+             abs(a->point[i].y - y) <= tol) {
  524. X+             *point_num = i;
  525. X+             return(1);
  526. X+             }
  527. X+         }
  528. X+         }
  529. X+     return(0);
  530. X+     }
  531. X+ 
  532. X+ char next_spline_point_found(x, y, tol, p, q, shift)
  533. X+ int    x, y, tol, shift;
  534. X+ F_point    **p, **q;
  535. X+ {
  536. X+         if (s==NULL)
  537. X+           s=objects.splines;
  538. X+         else if (shift) s=s->next;
  539. X+ 
  540. X+     for (;  s != NULL; s= s->next,n++) {
  541. X+         *p = NULL;
  542. X+         for (*q = s->points; *q != NULL; *p = *q, *q = (*q)->next) {
  543. X+         if (abs((*q)->x - x) <= tol && abs((*q)->y - y) <= tol)
  544. X+             return(1);
  545. X+         }
  546. X+         }
  547. X+     return(0);
  548. X+     }
  549. X+ 
  550. X+ char next_line_point_found(x, y, tol, p, q, shift)
  551. X+ int    x, y, tol, shift;
  552. X+ F_point    **p, **q;
  553. X+ {
  554. X+     F_point    *a, *b;
  555. X+ 
  556. X+         if (l==NULL)
  557. X+           l=objects.lines;
  558. X+         else if (shift) l=l->next;
  559. X+ 
  560. X+     for (; l != NULL; l= l->next,n++) {
  561. X+         for (a = NULL, b = l->points; b != NULL; a = b, b = b->next) {
  562. X+         if (abs(b->x - x) <= tol && abs(b->y - y) <= tol) {
  563. X+             *p = a;
  564. X+             *q = b;
  565. X+             return(1);
  566. X+             }
  567. X+         }
  568. X+         }
  569. X+     return(0);
  570. X+     }
  571. X+ 
  572. X+ void init_point_search(handlerproc)
  573. X+ int (*handlerproc)();
  574. X+ {
  575. X+     objectcount=0;
  576. X+     for (e=objects.ellipses;e!=NULL;e=e->next) objectcount++;
  577. X+     for (l=objects.lines;l!=NULL;l=l->next) objectcount++;
  578. X+     for (s=objects.splines;s!=NULL;s=s->next) objectcount++;
  579. X+     for (t=objects.texts;t!=NULL;t=t->next) objectcount++;
  580. X+     for (a=objects.arcs;a!=NULL;a=a->next) objectcount++;
  581. X+     for (c=objects.compounds;c!=NULL;c=c->next) objectcount++;
  582. X+     e=NULL;
  583. X+     type=O_ELLIPSE;
  584. X+     handlerproc_left=handlerproc;
  585. X+     objectmarker_shown=0;
  586. X+     }
  587. X+ 
  588. X+ void init_point_search_middle(handlerproc)
  589. X+ int (*handlerproc)();
  590. X+ {
  591. X+     objectcount=0;
  592. X+     for (e=objects.ellipses;e!=NULL;e=e->next) objectcount++;
  593. X+     for (l=objects.lines;l!=NULL;l=l->next) objectcount++;
  594. X+     for (s=objects.splines;s!=NULL;s=s->next) objectcount++;
  595. X+     for (t=objects.texts;t!=NULL;t=t->next) objectcount++;
  596. X+     for (a=objects.arcs;a!=NULL;a=a->next) objectcount++;
  597. X+     for (c=objects.compounds;c!=NULL;c=c->next) objectcount++;
  598. X+     e=NULL;
  599. X+     type=O_ELLIPSE;
  600. X+     handlerproc_middle=handlerproc;
  601. X+     objectmarker_shown=0;
  602. X+     }
  603. X+ 
  604. X+ void do_point_search(x,y,shift)
  605. X+ int    x, y;
  606. X+ unsigned int shift;  /* Shift Key Status from XEvent */
  607. X+ {
  608. X+     F_point *px,*py;
  609. X+     char found=0;
  610. X+         px= &point1;
  611. X+         py= &point2;
  612. X+     erase_objectmarker();
  613. X+     for (n=0;n<objectcount;)
  614. X+     {
  615. X+         switch(type)
  616. X+         { case O_ELLIPSE: if (next_ellipse_point_found(x,y,TOLERANCE,&px,&py,shift))
  617. X+              { found=1;
  618. X+              }
  619. X+                break;
  620. X+           case O_POLYLINE: if (next_line_point_found(x,y,TOLERANCE,&px,&py,shift))
  621. X+              { found=1;
  622. X+              }
  623. X+                break;
  624. X+           case O_SPLINE: if (next_spline_point_found(x,y,TOLERANCE,&px,&py,shift))
  625. X+              { found=1;
  626. X+              }
  627. X+                break;
  628. X+           case O_ARC: if (next_arc_point_found(x,y,TOLERANCE,&px,&py,shift))
  629. X+              { found=1;
  630. X+              }
  631. X+                break;
  632. X+         }
  633. X+         if (found) 
  634. X+         { if (! shift) break;
  635. X+           show_objectmarker();
  636. X+           found=0;
  637. X+           break;
  638. X+         }
  639. X+         switch(type)
  640. X+         { case O_ELLIPSE: type=O_POLYLINE;
  641. X+                   l=NULL;
  642. X+                   break;
  643. X+           case O_POLYLINE: type=O_SPLINE;
  644. X+                    s=NULL;
  645. X+                    break;
  646. X+           case O_SPLINE: type=O_ARC;
  647. X+                  a=NULL;
  648. X+                  break;
  649. X+           case O_ARC: type=O_ELLIPSE;
  650. X+               e=NULL;
  651. X+               break;
  652. X+         }
  653. X+     }
  654. X+     if (found) 
  655. X+     { finish_objectmarker();
  656. X+       switch(type)
  657. X+       { case O_ELLIPSE: manipulate(e,type,x,y,px,py);
  658. X+                 break;
  659. X+         case O_POLYLINE: manipulate(l,type,x,y,px,py);
  660. X+                 break;
  661. X+         case O_SPLINE: manipulate(s,type,x,y,px,py);
  662. X+                 break;
  663. X+         case O_ARC: manipulate(a,type,x,y,px,py);
  664. X+                 break;
  665. X+       }
  666. X+       /* On next invocation, start searching from the start */
  667. X+       e=NULL;
  668. X+       type=O_ELLIPSE;
  669. X+     }
  670. X+ }
  671. X+ 
  672. X+ 
  673. X+ void point_search(x,y,shift)
  674. X+ int    x, y;
  675. X+ unsigned int shift;  /* Shift Key Status from XEvent */
  676. X+ {
  677. X+   manipulate=handlerproc_left;
  678. X+   do_point_search(x,y,shift);
  679. X+ }
  680. X+ 
  681. X+ void point_search_middle(x,y,shift)
  682. X+ int    x, y;
  683. X+ unsigned int shift;  /* Shift Key Status from XEvent */
  684. X+ {
  685. X+   manipulate=handlerproc_middle;
  686. X+   do_point_search(x,y,shift);
  687. X+ }
  688. X+ 
  689. X+ /* =============================================================== */
  690. X+ 
  691. X+ /* These are the original search subroutines.
  692. X+    They are still used by some functions.
  693. X+ */
  694. X  
  695. X  F_arc *
  696. X  arc_search(x, y, tolerance, px, py)
  697. X*** @xfig.pl9/spline.c    Thu Jul  5 13:23:57 1990
  698. X--- ./spline.c    Mon Jun  3 11:16:08 1991
  699. X***************
  700. X*** 70,76 ****
  701. X      draw_elasticline();
  702. X      if (num_point <= 2) {
  703. X          pw_vector(canvas_win, first_point->x, first_point->y,
  704. X!             cur_point->x, cur_point->y, PAINT, 1, SOLID_LINE, 0.0);
  705. X          if (num_point == 1) {
  706. X          free((char*)cur_point);
  707. X          cur_point = NULL;
  708. X--- 70,76 ----
  709. X      draw_elasticline();
  710. X      if (num_point <= 2) {
  711. X          pw_vector(canvas_win, first_point->x, first_point->y,
  712. X!             cur_point->x, cur_point->y, PAINT, 1, RUBBER_LINE, 0.0);
  713. X          if (num_point == 1) {
  714. X          free((char*)cur_point);
  715. X          cur_point = NULL;
  716. X***************
  717. X*** 86,92 ****
  718. X          }
  719. X      spline->style = line_style;
  720. X      spline->thickness = line_thickness;
  721. X!     spline->style_val = cur_styleval;
  722. X      spline->color = cur_color;
  723. X      spline->depth = 0;
  724. X      spline->pen = 0;
  725. X--- 86,92 ----
  726. X          }
  727. X      spline->style = line_style;
  728. X      spline->thickness = line_thickness;
  729. X!     spline->style_val =  cur_styleval*(line_thickness+1)/2;
  730. X      spline->color = cur_color;
  731. X      spline->depth = 0;
  732. X      spline->pen = 0;
  733. X***************
  734. X*** 122,127 ****
  735. X--- 122,128 ----
  736. X          else
  737. X          spline->back_arrow = NULL;
  738. X          spline->type = T_OPEN_NORMAL;
  739. X+         spline->area_fill = fill_mode? cur_areafill : 0;
  740. X          draw_open_spline(spline, PAINT);
  741. X          }
  742. X      if (appres.DEBUG) {
  743. X*** @xfig.pl9/text.c    Wed Aug  1 15:56:29 1990
  744. X--- ./text.c    Wed Jun 12 09:01:51 1991
  745. X***************
  746. X*** 117,123 ****
  747. X          }
  748. X      draw_text(cur_text, PAINT);
  749. X      clean_up();
  750. X!     set_action_object(F_TEXT, O_TEXT);
  751. X      set_latesttext(cur_text);
  752. X      set_modifiedflag();
  753. X      }
  754. X--- 117,123 ----
  755. X          }
  756. X      draw_text(cur_text, PAINT);
  757. X      clean_up();
  758. X!     set_action_object(F_CREATE, O_TEXT);
  759. X      set_latesttext(cur_text);
  760. X      set_modifiedflag();
  761. X      }
  762. X***************
  763. X*** 154,159 ****
  764. X--- 154,161 ----
  765. X          base_y = cur_y;
  766. X          }
  767. X      else {         /* clicked on existing text */
  768. X+         /* must finish with left button */
  769. X+         /* canvas_middlebut_proc = null_proc; */
  770. X          /* leng_prefix is # of char in the text before the cursor */
  771. X          leng_suffix = strlen(cur_text->cstring);
  772. X          basx = cur_text->base_x;
  773. X***************
  774. X*** 283,291 ****
  775. X          {
  776. X          size = pf_textwidth(text->font,text->size,strlen(text->cstring),text->cstring);
  777. X          if (text->type == T_CENTER_JUSTIFIED)
  778. X!             x -= size.x/2;
  779. X          else
  780. X!             x -= size.x;
  781. X          }
  782. X      pw_text(canvas_win, x, text->base_y, 
  783. X          op, text->font, text->size, text->cstring);
  784. X--- 285,293 ----
  785. X          {
  786. X          size = pf_textwidth(text->font,text->size,strlen(text->cstring),text->cstring);
  787. X          if (text->type == T_CENTER_JUSTIFIED)
  788. X!             x -= size.x/2/zoomscale;
  789. X          else
  790. X!             x -= size.x/zoomscale;
  791. X          }
  792. X      pw_text(canvas_win, x, text->base_y, 
  793. X          op, text->font, text->size, text->cstring);
  794. X*** @xfig.pl9/turn.c    Mon Apr 30 12:13:55 1990
  795. X--- ./turn.c    Mon Jun  3 11:16:15 1991
  796. X***************
  797. X*** 14,21 ****
  798. X  #include "object.h"
  799. X  #include "paintop.h"
  800. X  
  801. X- #define            TOLERANCE    7
  802. X- 
  803. X  extern            (*canvas_kbd_proc)();
  804. X  extern            (*canvas_locmove_proc)();
  805. X  extern            (*canvas_leftbut_proc)();
  806. X--- 14,19 ----
  807. X***************
  808. X*** 31,64 ****
  809. X  extern F_spline        *spline_search();
  810. X  
  811. X  extern int        init_turn();
  812. X  
  813. X  turn_selected()
  814. X  {
  815. X      canvas_kbd_proc = null_proc;
  816. X      canvas_locmove_proc = null_proc;
  817. X!     canvas_leftbut_proc = init_turn;
  818. X      canvas_middlebut_proc = null_proc;
  819. X      canvas_rightbut_proc = set_popupmenu;
  820. X      set_cursor(&pick15_cursor);
  821. X      }
  822. X  
  823. X! init_turn(x, y)
  824. X  int    x, y;
  825. X  {
  826. X      F_line        *l;
  827. X      F_spline    *s;
  828. X-     int        dummy;
  829. X  
  830. X!     if ((l = line_search(x, y, TOLERANCE, &dummy, &dummy)) != NULL) {
  831. X          if (l->type == T_BOX || l->type == T_ARC_BOX) return;
  832. X          line_2_spline(l);
  833. X          turn_selected();
  834. X!         }
  835. X!     else if ((s = spline_search(x, y, TOLERANCE, &dummy, &dummy)) != NULL) {
  836. X          spline_2_line(s);
  837. X          turn_selected();
  838. X!         }
  839. X      }
  840. X  
  841. X  line_2_spline(l)
  842. X  F_line    *l;
  843. X--- 29,73 ----
  844. X  extern F_spline        *spline_search();
  845. X  
  846. X  extern int        init_turn();
  847. X+ extern init_object_search();
  848. X+ extern object_search();
  849. X  
  850. X+ 
  851. X  turn_selected()
  852. X  {
  853. X      canvas_kbd_proc = null_proc;
  854. X      canvas_locmove_proc = null_proc;
  855. X!     init_object_search(init_turn);
  856. X!     canvas_leftbut_proc = object_search;
  857. X      canvas_middlebut_proc = null_proc;
  858. X      canvas_rightbut_proc = set_popupmenu;
  859. X      set_cursor(&pick15_cursor);
  860. X      }
  861. X  
  862. X! init_turn(p,type,x, y,px,py)
  863. X! char *p;
  864. X! int type;
  865. X  int    x, y;
  866. X+ int px,py;
  867. X  {
  868. X      F_line        *l;
  869. X      F_spline    *s;
  870. X  
  871. X!     switch(type)
  872. X!     { case O_POLYLINE:
  873. X!         l=(F_line *) p;
  874. X          if (l->type == T_BOX || l->type == T_ARC_BOX) return;
  875. X          line_2_spline(l);
  876. X          turn_selected();
  877. X!         break;
  878. X!       case O_SPLINE:
  879. X!         s=(F_spline *) p;
  880. X          spline_2_line(s);
  881. X          turn_selected();
  882. X!         break;
  883. X!       default: return;
  884. X      }
  885. X+       }
  886. X  
  887. X  line_2_spline(l)
  888. X  F_line    *l;
  889. X*** @xfig.pl9/undo.c    Tue Apr 17 16:35:19 1990
  890. X--- ./undo.c    Mon Jun  3 10:56:11 1991
  891. X***************
  892. X*** 316,322 ****
  893. X              toggle_ellipsepointmarker(saved_objects.ellipses);
  894. X          break;
  895. X          case O_TEXT :
  896. X!         draw_text(saved_objects.texts, INV_PAINT);
  897. X          translate_text(saved_objects.texts, dx, dy);
  898. X          draw_text(saved_objects.texts, PAINT);
  899. X          break;
  900. X--- 316,322 ----
  901. X              toggle_ellipsepointmarker(saved_objects.ellipses);
  902. X          break;
  903. X          case O_TEXT :
  904. X!         draw_text(saved_objects.texts, ERASE);
  905. X          translate_text(saved_objects.texts, dx, dy);
  906. X          draw_text(saved_objects.texts, PAINT);
  907. X          break;
  908. X*** @xfig.pl9/util.c    Mon Apr 16 11:26:25 1990
  909. X--- ./util.c    Mon Jun  3 11:16:19 1991
  910. X***************
  911. X*** 143,148 ****
  912. X--- 143,149 ----
  913. X      F_arc        *a;
  914. X      F_line        *l;
  915. X      F_spline    *s;
  916. X+     F_text        *t;
  917. X  
  918. X      for (e = objects.ellipses; e != NULL; e = e->next) {
  919. X          toggle_ellipsepointmarker(e);
  920. X***************
  921. X*** 156,161 ****
  922. X--- 157,165 ----
  923. X      for (s = objects.splines; s != NULL; s = s->next) {
  924. X          toggle_splinepointmarker(s);
  925. X          }
  926. X+     for (t = objects.texts; t != NULL; t = t->next) {
  927. X+         toggle_textpointmarker(t);
  928. X+         }
  929. X      }
  930. X  
  931. X  toggle_ellipsepointmarker(e)
  932. X***************
  933. X*** 175,180 ****
  934. X--- 179,191 ----
  935. X      set_marker(canvas_win, a->point[1].x-2, a->point[1].y-2, 5, 5,
  936. X          INV_PAINT, &pmarker, 0, 0);
  937. X      set_marker(canvas_win, a->point[2].x-2, a->point[2].y-2, 5, 5,
  938. X+         INV_PAINT, &pmarker, 0, 0);
  939. X+     }
  940. X+ 
  941. X+ toggle_textpointmarker(t)
  942. X+ F_text    *t;
  943. X+ {
  944. X+     set_marker(canvas_win, t->base_x-2, t->base_y-2, 5, 5,
  945. X          INV_PAINT, &pmarker, 0, 0);
  946. X      }
  947. X  
  948. X*** @xfig.pl9/xfig.man    Fri Sep 21 14:36:17 1990
  949. X--- ./xfig.man    Tue Jun 11 17:06:13 1991
  950. X***************
  951. X*** 18,23 ****
  952. X--- 18,24 ----
  953. X  [\fIfile\fP]
  954. X  [\fB-normal[Font]\fP \fIfont\fP]
  955. X  [\fB-bold[Font]\fP \fIfont\fP]
  956. X+ [\fB-startfontsize \fIpointsize\fP]
  957. X  .SH DESCRIPTION
  958. X  .I Xfig 
  959. X  is a menu-driven tool that allows the user to draw and manipulate objects
  960. X***************
  961. X*** 107,113 ****
  962. X  \fB-tr\fP
  963. X  Turn on cursor (mouse) tracking arrows.
  964. X  .TP
  965. X! \fB-no\fP
  966. X  Turn off cursor (mouse) tracking arrows.
  967. X  .TP
  968. X  \fB-inc\fP
  969. X--- 108,114 ----
  970. X  \fB-tr\fP
  971. X  Turn on cursor (mouse) tracking arrows.
  972. X  .TP
  973. X! \fB-not\fP
  974. X  Turn off cursor (mouse) tracking arrows.
  975. X  .TP
  976. X  \fB-inc\fP
  977. X***************
  978. X*** 129,134 ****
  979. X--- 130,138 ----
  980. X  .TP
  981. X  \fB-bold\fP \fIfont\fP
  982. X  Cause the font used for displaying messages to be \fIfont\fP.
  983. X+ .TP
  984. X+ \fB-startfontsize\fP \fIpointsize\fP
  985. X+ Set the default font size for text objects.
  986. X  .SH "GRAPHICAL OBJECTS"
  987. X  The objects in \fIxfig\fP are divided into \fBprimitive objects\fP and
  988. X  \fBcompound object\fP. The primitive objects are: \fIARC\fP, \fICIRCLE\fP,
  989. X***************
  990. X*** 338,343 ****
  991. X--- 342,352 ----
  992. X  Press the "apply" button to apply the changes but keep the menu up for
  993. X  further changes.  Press the "cancel" button to cancel the changes and 
  994. X  pop down the menu.
  995. X+ 
  996. X+ The depth parameter of objects can only be changed using this tool.
  997. X+ It defines how overlapping objects are displayed. Objects with
  998. X+ a greater depth value are obstructed by objects with smaller depth
  999. X+ value. 
  1000. X  .TP
  1001. X  .I CIRCLE 
  1002. X  Create circles by specifying their radii or diameters.
  1003. X***************
  1004. X*** 507,513 ****
  1005. X  .TP
  1006. X  .I SOLID/DASHED/DOTTED LINE STYLE
  1007. X  Toggle between solid, dashed and dotted line styles. The dash length
  1008. X! is fixed at 0.05 inch.
  1009. X  .SH X DEFAULTS
  1010. X  The overall widget name(Class) is xfig.fig(Fig.TopLevelShell).  This
  1011. X  set of resources correspond to the command line arguments:
  1012. X--- 516,564 ----
  1013. X  .TP
  1014. X  .I SOLID/DASHED/DOTTED LINE STYLE
  1015. X  Toggle between solid, dashed and dotted line styles. The dash length
  1016. X! defaults to 0.05 inch * line width and can be changed using the
  1017. X! Change menu.
  1018. X! .SH "SELECTING OBJECTS"
  1019. X! When multiple objects have points in common, e.g. two boxes that
  1020. X! touch at one corner, only one object can be selected by clicking on
  1021. X! that point. To select other objects, hold down the shift key while
  1022. X! pressing the left mouse button: the markers of all objects but one will
  1023. X! vanish. By repeatedly clicking the left button while holding down
  1024. X! the shift key, it is possible to cycle through all candidates for
  1025. X! selection at that point. To perform the selected action, e.g. 
  1026. X! deleting one box, click on the point without holding down the
  1027. X! shift key.
  1028. X! 
  1029. X! This selection mechanism works for the following actions:
  1030. X! remove object, move object, copy object, add point, move point,
  1031. X! delete point, add/remove arrowhead, change object, switch object
  1032. X! polyline/spline.
  1033. X! .SH "ZOOMING/PANNING"
  1034. X! .TP
  1035. X! .I ZOOMING
  1036. X! If Zooming is selected, a zoom box can be defined by pressing the
  1037. X! left mouse button on one corner and the middle mouse button on the 
  1038. X! opposite one.
  1039. X! The integer zoom scale is displayed within the zoom button. Ruler,
  1040. X! grid and linewidth are scaled, too. Text objects can not be enlarged
  1041. X! and are therefore always displayed in their real point size.
  1042. X! The figure is unzoomed (i.e. the zoom scale is decreased by 1)
  1043. X! by pressing the middle mouse button in the
  1044. X! drawing area.
  1045. X! 
  1046. X! To reset the zoom scale to 1, click on the zoom button with the right 
  1047. X! mouse button.
  1048. X! .TP
  1049. X! .I PANNING
  1050. X! With panning selected, click with the left button on the drawing area
  1051. X! to define the new upper left corner of the displayed region; use the
  1052. X! middle button
  1053. X! to define its new center. The displayed region
  1054. X! is adjusted such that no negative coordinates are visible. The displayed
  1055. X! region can be panned at any time using the arrow keys.
  1056. X! 
  1057. X! Clicking the zoom button with the right button resets the pan window
  1058. X! to the upper left corner of the coordinate space.
  1059. X  .SH X DEFAULTS
  1060. X  The overall widget name(Class) is xfig.fig(Fig.TopLevelShell).  This
  1061. X  set of resources correspond to the command line arguments:
  1062. X***************
  1063. X*** 541,546 ****
  1064. X--- 592,600 ----
  1065. X  .TP
  1066. X  boldFont
  1067. X  (string:8x13bold) -bold argument
  1068. X+ .TP 
  1069. X+ startfontsize
  1070. X+ (integer:12) -startfontsize argument
  1071. X  .PP
  1072. X  These arguments correspond to the widgets which make up \fIxfig\fP.
  1073. X  .TP 1.5i
  1074. X***************
  1075. X*** 599,616 ****
  1076. X  \f(CWxfig*form.indicator.background: blue\fP
  1077. X  .SH BUGS
  1078. X  .PP
  1079. X- Creating a text object is not "Undoable".
  1080. X- .PP
  1081. X  Area fill doesn't show on the canvas for closed splines, but are filled 
  1082. X  when printed.  This has to do with the way the splines are generated on the
  1083. X  screen.
  1084. X  .PP
  1085. X! Undoing the creation of a compound object deletes the objects
  1086. X! outside the compound object.  Undoing the undo doesn't bring them back.
  1087. X  .PP
  1088. X  Undoing a move-point of a box or arc-box will corrupt the object.
  1089. X  .PP
  1090. X  Ellipses which are too narrow are not drawn correctly.
  1091. X  .SH "SEE ALSO"
  1092. X  Brian W. Kernighan
  1093. X  .I "PIC - A Graphics Language for Typesetting User Manual"
  1094. X--- 653,682 ----
  1095. X  \f(CWxfig*form.indicator.background: blue\fP
  1096. X  .SH BUGS
  1097. X  .PP
  1098. X  Area fill doesn't show on the canvas for closed splines, but are filled 
  1099. X  when printed.  This has to do with the way the splines are generated on the
  1100. X  screen.
  1101. X  .PP
  1102. X! Undo of creation of compound object is disabled due to a bug that
  1103. X! deleted objects OUTSIDE of the compound.
  1104. X  .PP
  1105. X  Undoing a move-point of a box or arc-box will corrupt the object.
  1106. X  .PP
  1107. X  Ellipses which are too narrow are not drawn correctly.
  1108. X+ .PP
  1109. X+ Generating a closed interpolated spline by clicking with the middle
  1110. X+ mouse button on the starting point of the spline results in a core
  1111. X+ dump
  1112. X+ .PP
  1113. X+ Drawing an ellipse specifying diameters with height 0, then
  1114. X+ applying the change menu and clicking on the done button leads to a
  1115. X+ core dump
  1116. X+ .PP
  1117. X+ There are two redraws after starting xfig and when changing the grid.
  1118. X+ Annoying on slow terminals
  1119. X+ .PP
  1120. X+ When an arrow key is pressed while drawing e.g. a line, the picture
  1121. X+ is distorted by the panning operation
  1122. X  .SH "SEE ALSO"
  1123. X  Brian W. Kernighan
  1124. X  .I "PIC - A Graphics Language for Typesetting User Manual"
  1125. X***************
  1126. X*** 688,690 ****
  1127. X--- 754,766 ----
  1128. X  Frank Schmuck 
  1129. X  .br
  1130. X  (schmuck@svax.cs.cornell.edu)
  1131. X+ .sp
  1132. X+ Zooming and panning functions, shift key select mechanism by:
  1133. X+ .br
  1134. X+ Dieter Pellkofer
  1135. X+ (dip@regent.e-technik.tu-muenchen.de)
  1136. X+ .br
  1137. X+ and
  1138. X+ .br
  1139. X+ Henning Spruth
  1140. X+ (hns@regent.e-technik.tu-muenchen.de)
  1141. X*** /dev/null    Fri Jun 14 10:34:50 1991
  1142. X--- zoom.h    Thu May 16 05:02:28 1991
  1143. X***************
  1144. X*** 0 ****
  1145. X--- 1,42 ----
  1146. X+ #ifndef ZOOMDEF
  1147. X+ extern long zoomscale;
  1148. X+ extern long zoomxoff;
  1149. X+ extern long zoomyoff;
  1150. X+ 
  1151. X+ #define ZOOMX(x) (zoomscale*(x-zoomxoff))
  1152. X+ #define ZOOMY(y) (zoomscale*(y-zoomyoff))
  1153. X+ #define BACKX(x) ((int) x/(float)zoomscale+zoomxoff+0.5)
  1154. X+ #define BACKY(y) ((int) y/(float)zoomscale+zoomyoff+0.5)
  1155. X+ 
  1156. X+ #define ZOOMSTEP 50
  1157. X+ 
  1158. X+ #define zXDrawPoint(d,w,gc,x,y) XDrawPoint(d,w,gc,ZOOMX(x),ZOOMY(y))
  1159. X+ #define zXDrawArc(d,w,gc,x,y,d1,d2,a1,a2)\
  1160. X+     XDrawArc(d,w,gc,ZOOMX(x),ZOOMY(y),zoomscale*(d1),zoomscale*(d2),\
  1161. X+           a1,a2)
  1162. X+ #define zXFillArc(d,w,gc,x,y,d1,d2,a1,a2)\
  1163. X+     XFillArc(d,w,gc,ZOOMX(x),ZOOMY(y),zoomscale*(d1),zoomscale*(d2),\
  1164. X+           a1,a2)
  1165. X+ #define zXDrawLine(d,w,gc,x1,y1,x2,y2)\
  1166. X+     XDrawLine(d,w,gc,ZOOMX(x1),ZOOMY(y1),ZOOMX(x2),ZOOMY(y2))
  1167. X+ #define zXDrawString(d,w,gc,x,y,s,l)\
  1168. X+     XDrawString(d,w,gc,ZOOMX(x),ZOOMY(y),s,l)
  1169. X+ #define zXFillRectangle(d,w,gc,x1,y1,x2,y2)\
  1170. X+     XFillRectangle(d,w,gc,ZOOMX(x1),ZOOMY(y1),zoomscale*(x2),zoomscale*(y2))
  1171. X+ #define zXDrawRectangle(d,w,gc,x1,y1,x2,y2)\
  1172. X+     XDrawRectangle(d,w,gc,ZOOMX(x1),ZOOMY(y1),zoomscale*(x2),zoomscale*(y2))
  1173. X+ #define zXDrawLines(d,w,gc,p,n,m)\
  1174. X+     {int i;\
  1175. X+      for(i=0;i<n;i++){p[i].x=ZOOMX(p[i].x);p[i].y=ZOOMY(p[i].y);}\
  1176. X+      XDrawLines(d,w,gc,p,n,m);\
  1177. X+      for(i=0;i<n;i++){p[i].x=BACKX(p[i].x);p[i].y=BACKY(p[i].y);}\
  1178. X+     }
  1179. X+ 
  1180. X+ #define zXFillPolygon(d,w,gc,p,n,m,o)\
  1181. X+     {int i;\
  1182. X+      for(i=0;i<n;i++){p[i].x=ZOOMX(p[i].x);p[i].y=ZOOMY(p[i].y);}\
  1183. X+      XFillPolygon(d,w,gc,p,n,m,o);\
  1184. X+      for(i=0;i<n;i++){p[i].x=BACKX(p[i].x);p[i].y=BACKY(p[i].y);}\
  1185. X+     }
  1186. X+ #define ZOOMDEF
  1187. X+ #endif
  1188. X*** /dev/null    Fri Jun 14 10:34:50 1991
  1189. X--- zoom.c    Thu Jun 13 08:32:20 1991
  1190. X***************
  1191. X*** 0 ****
  1192. X--- 1,117 ----
  1193. X+ /* 
  1194. X+  *    FIG : Facility for Interactive Generation of figures
  1195. X+  *
  1196. X+  *    Copyright (c) 1991 by Henning Spruth 
  1197. X+  *    (hns@regent.e-technik.tu-muenchen.de)
  1198. X+  *    May 1991
  1199. X+  *
  1200. X+  *      %W%     %G%
  1201. X+  *
  1202. X+  */
  1203. X+ 
  1204. X+ #include "fig.h"
  1205. X+ #include "resources.h"
  1206. X+ #include "alloc.h"
  1207. X+ #include "func.h"
  1208. X+ #include "object.h"
  1209. X+ #include "paintop.h"
  1210. X+ #include "zoom.h"
  1211. X+ 
  1212. X+ extern                  (*canvas_kbd_proc)();
  1213. X+ extern                  (*canvas_locmove_proc)();
  1214. X+ extern                  (*canvas_leftbut_proc)();
  1215. X+ extern                  (*canvas_middlebut_proc)();
  1216. X+ extern                  (*canvas_rightbut_proc)();
  1217. X+ 
  1218. X+ extern                  null_proc();
  1219. X+ extern                  set_popupmenu();
  1220. X+ extern  int             CANVAS_WIDTH, CANVAS_HEIGHT;
  1221. X+ extern int              fix_x, fix_y, cur_x, cur_y;
  1222. X+ 
  1223. X+ static            do_zoom();
  1224. X+ static            zoom_up();
  1225. X+ static            init_zoombox_drawing();
  1226. X+ extern            elastic_box();
  1227. X+ extern int              gc_thickness[NUMOPS];
  1228. X+ 
  1229. X+ long zoomscale=1;
  1230. X+ long zoomxoff=0;
  1231. X+ long zoomyoff=0;
  1232. X+ 
  1233. X+ zoom_canvas_selected()
  1234. X+ {
  1235. X+         canvas_kbd_proc = null_proc;
  1236. X+         canvas_locmove_proc = null_proc;
  1237. X+         canvas_leftbut_proc = init_zoombox_drawing;
  1238. X+         canvas_middlebut_proc = zoom_up;
  1239. X+         canvas_rightbut_proc = set_popupmenu;
  1240. X+         set_cursor(&arrow_cursor);
  1241. X+         reset_action_on();
  1242. X+ }
  1243. X+ 
  1244. X+ static init_zoombox_drawing(x, y)
  1245. X+ int     x, y;
  1246. X+ {
  1247. X+         cur_x = fix_x = x;
  1248. X+         cur_y = fix_y = y;
  1249. X+         canvas_locmove_proc = elastic_box;
  1250. X+         canvas_leftbut_proc = canvas_rightbut_proc = null_proc;
  1251. X+         canvas_middlebut_proc = do_zoom;
  1252. X+         draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
  1253. X+         set_temp_cursor(&null_cursor);
  1254. X+         set_action_on();
  1255. X+ }
  1256. X+ 
  1257. X+ static do_zoom(x,y)
  1258. X+ int x,y;
  1259. X+ {
  1260. X+      int dimx,dimy;
  1261. X+     int t; /* loop counter */
  1262. X+     float scalex,scaley;
  1263. X+         draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
  1264. X+         zoomxoff= fix_x<x ? fix_x : x;
  1265. X+         zoomyoff= fix_y<y ? fix_y : y;
  1266. X+     dimx=abs(x-fix_x);
  1267. X+     dimy=abs(y-fix_y);
  1268. X+     if (zoomxoff<0) zoomxoff=0;
  1269. X+     if (zoomyoff<0) zoomyoff=0;
  1270. X+     if (dimx && dimy)
  1271. X+     { scalex=CANVAS_WIDTH/(float) dimx;
  1272. X+       scaley=CANVAS_HEIGHT/(float) dimy;
  1273. X+       zoomscale= (int) scalex>scaley ? scaley : scalex;
  1274. X+       if (zoomscale>9) zoomscale=9;
  1275. X+       show_zoomscale();
  1276. X+           for (t=0;t<NUMOPS;t++) gc_thickness[t]= -1;
  1277. X+       setup_rulers();
  1278. X+       redisplay_rulers();
  1279. X+       setup_grid(0);
  1280. X+     }
  1281. X+     zoom_canvas_selected();
  1282. X+ }
  1283. X+ 
  1284. X+ static zoom_up()
  1285. X+ {
  1286. X+     int t; /* loop counter */
  1287. X+     if (zoomscale>1)
  1288. X+     { zoomscale--;
  1289. X+       show_zoomscale();
  1290. X+       for (t=0;t<NUMOPS;t++) gc_thickness[t]= -1;
  1291. X+       setup_rulers();
  1292. X+       redisplay_rulers();
  1293. X+       setup_grid(0);
  1294. X+     }
  1295. X+     zoom_canvas_selected();
  1296. X+ }
  1297. X+       
  1298. X+ zoom_scale_1()
  1299. X+ {
  1300. X+     int t; /* loop counter */
  1301. X+     zoomscale=1;
  1302. X+     zoomxoff=0;
  1303. X+     zoomyoff=0;
  1304. X+     show_zoomscale();
  1305. X+     setup_rulers();
  1306. X+     for (t=0;t<NUMOPS;t++) gc_thickness[t]= -1;
  1307. X+         redisplay_rulers();
  1308. X+         setup_grid(0);
  1309. X+ }
  1310. X*** /dev/null    Fri Jun 14 10:34:50 1991
  1311. X--- pan.c    Thu Jun 13 08:32:08 1991
  1312. X***************
  1313. X*** 0 ****
  1314. X--- 1,86 ----
  1315. X+ /* 
  1316. X+  *    FIG : Facility for Interactive Generation of figures
  1317. X+  *
  1318. X+  *    Copyright (c) 1991 by Henning Spruth 
  1319. X+  *    (hns@regent.e-technik.tu-muenchen.de)
  1320. X+  *    May 1991
  1321. X+  *
  1322. X+  *      %W%     %G%
  1323. X+  *
  1324. X+  */
  1325. X+ 
  1326. X+ #include "fig.h"
  1327. X+ #include "resources.h"
  1328. X+ #include "alloc.h"
  1329. X+ #include "func.h"
  1330. X+ #include "object.h"
  1331. X+ #include "paintop.h"
  1332. X+ #include "zoom.h"
  1333. X+ 
  1334. X+ extern                  (*canvas_kbd_proc)();
  1335. X+ extern                  (*canvas_locmove_proc)();
  1336. X+ extern                  (*canvas_leftbut_proc)();
  1337. X+ extern                  (*canvas_middlebut_proc)();
  1338. X+ extern                  (*canvas_rightbut_proc)();
  1339. X+ extern             null_proc();
  1340. X+ extern                  set_popupmenu();
  1341. X+ extern    int        CANVAS_WIDTH, CANVAS_HEIGHT;
  1342. X+ 
  1343. X+ static int do_pan_left();
  1344. X+ static int do_pan_middle();
  1345. X+ static int do_pan_right();
  1346. X+ 
  1347. X+ pan_canvas_selected()
  1348. X+ {
  1349. X+         canvas_kbd_proc = null_proc;
  1350. X+         canvas_locmove_proc = null_proc;
  1351. X+         canvas_leftbut_proc = do_pan_left;
  1352. X+         canvas_middlebut_proc = do_pan_middle;
  1353. X+         canvas_rightbut_proc = do_pan_right;
  1354. X+         set_cursor(&arrow_cursor);
  1355. X+         reset_action_on();
  1356. X+ }
  1357. X+ 
  1358. X+ static do_pan_left(x,y)
  1359. X+ int x,y;
  1360. X+ {
  1361. X+     zoomxoff=x;
  1362. X+         zoomyoff=y;
  1363. X+         setup_rulers();
  1364. X+         redisplay_rulers();
  1365. X+         setup_grid(0);
  1366. X+ }
  1367. X+   
  1368. X+ static do_pan_middle(x,y)
  1369. X+ int x,y;
  1370. X+ {
  1371. X+     zoomxoff=x-CANVAS_WIDTH/2/zoomscale;
  1372. X+     zoomyoff=y-CANVAS_HEIGHT/2/zoomscale;
  1373. X+     if (zoomxoff<0) zoomxoff=0;
  1374. X+     if (zoomyoff<0) zoomyoff=0;
  1375. X+         setup_rulers();
  1376. X+         redisplay_rulers();
  1377. X+         setup_grid(0);
  1378. X+ }    
  1379. X+ 
  1380. X+ static do_pan_right(x,y)
  1381. X+ int x,y;
  1382. X+ {
  1383. X+     zoomxoff=x-CANVAS_WIDTH/zoomscale;
  1384. X+     zoomyoff=y-CANVAS_HEIGHT/zoomscale;
  1385. X+     if (zoomxoff<0) zoomxoff=0;
  1386. X+     if (zoomyoff<0) zoomyoff=0;
  1387. X+         setup_rulers();
  1388. X+         redisplay_rulers();
  1389. X+         setup_grid(0);
  1390. X+ }    
  1391. X+ 
  1392. X+ pan_origin()
  1393. X+ {
  1394. X+     zoomxoff=0;
  1395. X+     zoomyoff=0;
  1396. X+         setup_rulers();
  1397. X+         redisplay_rulers();
  1398. X+         setup_grid(0);
  1399. X+ /*    pan_canvas_selected();*/
  1400. X+ }
  1401. X*** @xfig.pl9/panel.c    Mon Aug 13 11:13:57 1990
  1402. X--- panel.c    Fri Jun 14 11:25:52 1991
  1403. X***************
  1404. X*** 24,30 ****
  1405. X  extern        change_directory();
  1406. X  extern        print_wdir();
  1407. X  extern        print_figure();
  1408. X! extern        finish_text_input();
  1409. X  extern    int    line_thickness;
  1410. X  extern    int    cur_radius;
  1411. X  extern    int    cur_areafill;
  1412. X--- 24,33 ----
  1413. X  extern        change_directory();
  1414. X  extern        print_wdir();
  1415. X  extern        print_figure();
  1416. X! extern        save_finish_text_input();
  1417. X! extern    int    cur_command;
  1418. X! extern    int    rotate_angle;
  1419. X! extern    int    flip_axis;
  1420. X  extern    int    line_thickness;
  1421. X  extern    int    cur_radius;
  1422. X  extern    int    cur_areafill;
  1423. X***************
  1424. X*** 39,44 ****
  1425. X--- 42,48 ----
  1426. X  extern    int    cur_printer;
  1427. X  extern    char    *printer_list[];
  1428. X  extern    TOOL    fontmenu;        /* popup menu for printer fonts */
  1429. X+ extern    int    cur_command;
  1430. X  extern    appresStruct    appres;
  1431. X  extern    int    font_button;        /* "current" font */
  1432. X  extern    int    *font_sel;        /* pointer to store font selected from popup */
  1433. X***************
  1434. X*** 88,99 ****
  1435. X--- 92,106 ----
  1436. X  static    Pixmap    print_sel_pm;    /* pixmap for printer selection widget */
  1437. X  static    Pixmap    font_size_pm;    /* pixmap for printer selection widget */
  1438. X  static    Pixmap    font_step_pm;    /* pixmap for text step widget */
  1439. X+ static  Pixmap  zoom_pm;    /* pixmap for zoom widget */
  1440. X  static    Pixmap    text_just_pm[3]; /* pixmaps for left/center/right just widget */
  1441. X  static    Widget    print_sel_widget;
  1442. X  static    Widget    font_size_widget;
  1443. X  static    Widget    font_step_widget;
  1444. X+ static     Widget    zoom_widget;
  1445. X  static    F_switch *text_just_sw;    /* text justification button */
  1446. X  static    F_switch *land_port_sw;    /* landscape/portrait button */
  1447. X+ static F_switch *zoom_sw;
  1448. X  
  1449. X  TOOL    ind_box;    /* allow main() to access this widget */
  1450. X  
  1451. X***************
  1452. X*** 146,162 ****
  1453. X      { 1, 3, 0, 0, &solidline_ic, F_SET_SOLID_LINE, set_style, null_proc, S_ON, },
  1454. X      { 0, 3, 0, 0, &dashline_ic, F_SET_DASH_LINE, set_style, null_proc, S_ON, },
  1455. X      { 0, 3, 0, 0, &dottedline_ic, F_SET_DOTTED_LINE, set_style, null_proc, S_ON, },
  1456. X!     { 0, 1, 0, 0, &grid1_ic, F_GRID1, set_grid, set_grid, S_TOG, },
  1457. X      { 0,-1, 0, 0, &backarrow_ic, F_AUTOB_ARROW, mode_on, mode_off, S_TOG, },
  1458. X      { 0,-1, 0, 0, &forarrow_ic, F_AUTOF_ARROW, mode_on, mode_off, S_TOG, },
  1459. X!     { 0, 1, 0, 0, &grid2_ic, F_GRID2, set_grid, set_grid, S_TOG, },
  1460. X  #ifdef TFX
  1461. X      { 0,-1, 0, 0, &fill_ic, F_FILL, mode_on, mode_off, S_TOG, },
  1462. X!     { 1,-1, 0, 0, &magnet_ic, F_MAGNET, mode_on, mode_off, S_TOG, },
  1463. X  #else
  1464. X!     { 1,-1, 0, 0, &magnet_ic, F_MAGNET, mode_on, mode_off, S_TOG, },
  1465. X      { 0,-1, 0, 0, &fill_ic, F_FILL, mode_on, mode_off, S_TOG, },
  1466. X  #endif
  1467. X      { 0,-1, 0, 0, &incdec_thick_ic, F_INCDECTHICK, dec_thick, null_proc, S_MOMENT,},
  1468. X  #ifndef TFX
  1469. X      { 0,-1, 0, 0, &incdec_radius_ic, F_INCDECRADIUS, dec_radius, null_proc, S_MOMENT,},
  1470. X--- 153,175 ----
  1471. X      { 1, 3, 0, 0, &solidline_ic, F_SET_SOLID_LINE, set_style, null_proc, S_ON, },
  1472. X      { 0, 3, 0, 0, &dashline_ic, F_SET_DASH_LINE, set_style, null_proc, S_ON, },
  1473. X      { 0, 3, 0, 0, &dottedline_ic, F_SET_DOTTED_LINE, set_style, null_proc, S_ON, },
  1474. X!     { 0, 1 , 0, 0, &grid1_ic, F_GRID1, mode_on, mode_off, S_TOG, },
  1475. X      { 0,-1, 0, 0, &backarrow_ic, F_AUTOB_ARROW, mode_on, mode_off, S_TOG, },
  1476. X      { 0,-1, 0, 0, &forarrow_ic, F_AUTOF_ARROW, mode_on, mode_off, S_TOG, },
  1477. X!     { 0, 1 , 0, 0, &grid2_ic, F_GRID2, mode_on, mode_off, S_TOG, },
  1478. X!     { 1,-1, 0, 0, &magnet_ic, F_MAGNET, mode_on, mode_off, S_TOG, },
  1479. X  #ifdef TFX
  1480. X+     { 0, 0, 0, 0, &zoom_ic, F_ZOOM, set_command, null_proc, S_ON,},
  1481. X+     { 0,-1, 0, 0, &blank_ic, F_NOP, null_proc, null_proc, S_MOMENT, },
  1482. X      { 0,-1, 0, 0, &fill_ic, F_FILL, mode_on, mode_off, S_TOG, },
  1483. X!     { 0, 0, 0, 0, &pan_ic, F_PAN, set_command, null_proc, S_ON,},
  1484. X  #else
  1485. X!     { 0,-1, 0, 0, &blank_ic, F_NOP, null_proc, null_proc, S_MOMENT, },
  1486. X!     { 0, 0, 0, 0, &zoom_ic, F_ZOOM, set_command, null_proc, S_ON,},
  1487. X!     { 0, 0, 0, 0, &pan_ic, F_PAN, set_command, null_proc, S_ON,},
  1488. X      { 0,-1, 0, 0, &fill_ic, F_FILL, mode_on, mode_off, S_TOG, },
  1489. X  #endif
  1490. X+ 
  1491. X      { 0,-1, 0, 0, &incdec_thick_ic, F_INCDECTHICK, dec_thick, null_proc, S_MOMENT,},
  1492. X  #ifndef TFX
  1493. X      { 0,-1, 0, 0, &incdec_radius_ic, F_INCDECRADIUS, dec_radius, null_proc, S_MOMENT,},
  1494. X***************
  1495. X*** 406,411 ****
  1496. X--- 419,430 ----
  1497. X                  sw->icon->width, sw->icon->height,fg,bg,
  1498. X                  DefaultDepthOfScreen(s));
  1499. X  
  1500. X+         if (sw->value == F_ZOOM) /* save pointer to pixmap/widget for zoom */
  1501. X+             {
  1502. X+             zoom_pm = p;
  1503. X+             zoom_widget = sw->but.widget;
  1504. X+             zoom_sw=sw;
  1505. X+             }
  1506. X          sw->but.normal = button_args[3].value = (XtArgVal)p;
  1507. X          XtSetValues(sw->but.widget, &button_args[3], 1);
  1508. X      }
  1509. X***************
  1510. X*** 538,543 ****
  1511. X--- 557,572 ----
  1512. X          case F_STEP:
  1513. X              inc_step_button(sw);
  1514. X              break;            
  1515. X+         case F_ZOOM:
  1516. X+                /* turn_off_old_switch();    
  1517. X+             turn_on(sw);*/
  1518. X+             zoom_scale_1();
  1519. X+             break;
  1520. X+         case F_PAN:
  1521. X+                 /*turn_off_old_switch();    
  1522. X+             turn_on(sw);*/
  1523. X+             pan_origin();
  1524. X+             break;
  1525. X          }
  1526. X      }
  1527. X  
  1528. X***************
  1529. X*** 646,657 ****
  1530. X  set_command(sw)
  1531. X  F_switch    *sw;
  1532. X  {
  1533. X-     extern int    cur_command;
  1534. X-     extern int    rotate_angle;
  1535. X-     extern int    flip_axis;
  1536. X- 
  1537. X      if (cur_command == F_TEXT)
  1538. X!         finish_text_input();    /* finish up any text input */
  1539. X      switch (sw->value) {
  1540. X          case F_CIRCLE_BY_RAD :
  1541. X          circlebyradius_drawing_selected();
  1542. X--- 675,682 ----
  1543. X  set_command(sw)
  1544. X  F_switch    *sw;
  1545. X  {
  1546. X      if (cur_command == F_TEXT)
  1547. X!         save_finish_text_input();    /* finish up any text input */
  1548. X      switch (sw->value) {
  1549. X          case F_CIRCLE_BY_RAD :
  1550. X          circlebyradius_drawing_selected();
  1551. X***************
  1552. X*** 839,846 ****
  1553. X                  show_compoundbox();
  1554. X                  put_msg("CHANGE OBJECT");
  1555. X                  break;
  1556. X! 
  1557. X! 
  1558. X          }
  1559. X      cur_command = sw->value;
  1560. X      }
  1561. X--- 864,881 ----
  1562. X                  show_compoundbox();
  1563. X                  put_msg("CHANGE OBJECT");
  1564. X                  break;
  1565. X!         case F_PAN:
  1566. X!         pan_canvas_selected();
  1567. X!         erase_pointmarker();
  1568. X!         erase_compoundbox();
  1569. X!         put_msg("Click: left button=new upper left, middle button=new center");
  1570. X!         break;
  1571. X!         case F_ZOOM:
  1572. X!         zoom_canvas_selected();
  1573. X!         erase_pointmarker();
  1574. X!         erase_compoundbox();
  1575. X!         put_msg("Click: left button=define zoom rectangle, middle button=unzoom one step");
  1576. X!         break;
  1577. X          }
  1578. X      cur_command = sw->value;
  1579. X      }
  1580. X***************
  1581. X*** 914,919 ****
  1582. X--- 949,955 ----
  1583. X      extern int    autoforwardarrow_mode;
  1584. X      extern int    autobackwardarrow_mode;
  1585. X      extern int    magnet_mode;
  1586. X+     extern int    grid2_mode;
  1587. X  
  1588. X      switch (sw->value) {
  1589. X          case F_AUTOF_ARROW :
  1590. X***************
  1591. X*** 927,933 ****
  1592. X          case F_MAGNET :
  1593. X          magnet_mode = 1;
  1594. X          put_msg("MAGNET: round entered points to the nearest %s increment",
  1595. X!                 (appres.INCHES? "1/16\"": "2 mm"));
  1596. X          break;
  1597. X          case F_FILL :
  1598. X          fill_mode = 1;
  1599. X--- 963,969 ----
  1600. X          case F_MAGNET :
  1601. X          magnet_mode = 1;
  1602. X          put_msg("MAGNET: round entered points to the nearest %s increment",
  1603. X!                 (appres.INCHES? "1/16\"": (grid2_mode? "5mm":"1mm")));
  1604. X          break;
  1605. X          case F_FILL :
  1606. X          fill_mode = 1;
  1607. X***************
  1608. X*** 934,939 ****
  1609. X--- 970,985 ----
  1610. X          put_fmsg("FILL MODE (gray level = %.2lf)",
  1611. X               (double)1.0-(cur_areafill-1.0)/(NUMFILLPATS-1.0));
  1612. X          break;
  1613. X+         case F_GRID1 :
  1614. X+         grid2_mode = 0;
  1615. X+         setup_grid(sw->value);
  1616. X+         put_msg("GRID1 on");
  1617. X+         break;
  1618. X+         case F_GRID2 :
  1619. X+         grid2_mode = 1;
  1620. X+         setup_grid(sw->value);
  1621. X+         put_msg("GRID2 on");
  1622. X+         break;
  1623. X          }
  1624. X      }
  1625. X  
  1626. X***************
  1627. X*** 944,949 ****
  1628. X--- 990,996 ----
  1629. X      extern int    autoforwardarrow_mode;
  1630. X      extern int    autobackwardarrow_mode;
  1631. X      extern int    magnet_mode;
  1632. X+     extern int    grid2_mode;
  1633. X  
  1634. X      switch (sw->value) {
  1635. X          case F_AUTOF_ARROW :
  1636. X***************
  1637. X*** 959,964 ****
  1638. X--- 1006,1020 ----
  1639. X          fill_mode = 0;
  1640. X          put_msg("NO-FILL MODE");
  1641. X          break;
  1642. X+         case F_GRID1 :
  1643. X+         setup_grid(sw->value);
  1644. X+         put_msg("NO GRID");
  1645. X+         break;
  1646. X+         case F_GRID2 :
  1647. X+         grid2_mode = 0;
  1648. X+         setup_grid(sw->value);
  1649. X+         put_msg("NO GRID");
  1650. X+         break;
  1651. X          }
  1652. X      }
  1653. X  
  1654. X***************
  1655. X*** 1022,1033 ****
  1656. X      /* erase by drawing wide, inverted (white) line */
  1657. X      pw_vector(line_pm, 0, SWITCH_ICON_HEIGHT/2,
  1658. X          SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, ERASE, 
  1659. X!         SWITCH_ICON_HEIGHT, SOLID_LINE, 0.0);
  1660. X      /* draw current line thickness into pixmap */
  1661. X      if (line_thickness > 0)        /* don't draw line for zero-thickness */
  1662. X          pw_vector(line_pm, 0, SWITCH_ICON_HEIGHT/2, 
  1663. X          SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, PAINT, 
  1664. X!         line_thickness, SOLID_LINE, 0.0);
  1665. X  
  1666. X      /* Fool the toolkit by changing the background pixmap to 0
  1667. X         then giving it the modified one again.  Otherwise, it sees
  1668. X--- 1078,1089 ----
  1669. X      /* erase by drawing wide, inverted (white) line */
  1670. X      pw_vector(line_pm, 0, SWITCH_ICON_HEIGHT/2,
  1671. X          SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, ERASE, 
  1672. X!         SWITCH_ICON_HEIGHT, PANEL_LINE, 0.0);
  1673. X      /* draw current line thickness into pixmap */
  1674. X      if (line_thickness > 0)        /* don't draw line for zero-thickness */
  1675. X          pw_vector(line_pm, 0, SWITCH_ICON_HEIGHT/2, 
  1676. X          SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, PAINT, 
  1677. X!         line_thickness, PANEL_LINE, 0.0);
  1678. X  
  1679. X      /* Fool the toolkit by changing the background pixmap to 0
  1680. X         then giving it the modified one again.  Otherwise, it sees
  1681. X***************
  1682. X*** 1078,1089 ****
  1683. X      /* erase by drawing wide, inverted (white) line */
  1684. X      pw_vector(radius_pm, 0, SWITCH_ICON_HEIGHT/2,
  1685. X          SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, ERASE, 
  1686. X!         SWITCH_ICON_HEIGHT, SOLID_LINE, 0.0);
  1687. X      /* draw current radius into pixmap */
  1688. X      curve(radius_pm, 0, cur_radius, cur_radius, 0, 0,
  1689. X          cur_radius, cur_radius,
  1690. X          1, SWITCH_ICON_HEIGHT-2, foreground_color, 
  1691. X!         1, SOLID_LINE, 0.0, 0);
  1692. X  
  1693. X      /* Fool the toolkit by changing the background pixmap to 0
  1694. X         then giving it the modified one again.  Otherwise, it sees
  1695. X--- 1134,1145 ----
  1696. X      /* erase by drawing wide, inverted (white) line */
  1697. X      pw_vector(radius_pm, 0, SWITCH_ICON_HEIGHT/2,
  1698. X          SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, ERASE, 
  1699. X!         SWITCH_ICON_HEIGHT, PANEL_LINE, 0.0);
  1700. X      /* draw current radius into pixmap */
  1701. X      curve(radius_pm, 0, cur_radius, cur_radius, 0, 0,
  1702. X          cur_radius, cur_radius,
  1703. X          1, SWITCH_ICON_HEIGHT-2, foreground_color, 
  1704. X!         1, PANEL_LINE, 0.0, 0);
  1705. X  
  1706. X      /* Fool the toolkit by changing the background pixmap to 0
  1707. X         then giving it the modified one again.  Otherwise, it sees
  1708. X***************
  1709. X*** 1367,1373 ****
  1710. X  /* could make this more generic - but a copy will do for font set JNT */
  1711. X  show_textstep()
  1712. X      {
  1713. X!     put_msg("Font step %.1f",step_button / 10.0);
  1714. X      /* write the font size in the background pixmap */
  1715. X      tmpsiz[0]=tmpsiz[1]=tmpsiz[2]=tmpsiz[3]=tmpsiz[4]='\0';
  1716. X      sprintf(tmpsiz,"%3.1f",step_button / 10.0);
  1717. X--- 1423,1429 ----
  1718. X  /* could make this more generic - but a copy will do for font set JNT */
  1719. X  show_textstep()
  1720. X      {
  1721. X!     put_fmsg("Font step %.1f",(double) step_button / 10.0);
  1722. X      /* write the font size in the background pixmap */
  1723. X      tmpsiz[0]=tmpsiz[1]=tmpsiz[2]=tmpsiz[3]=tmpsiz[4]='\0';
  1724. X      sprintf(tmpsiz,"%3.1f",step_button / 10.0);
  1725. X***************
  1726. X*** 1465,1468 ****
  1727. X--- 1521,1562 ----
  1728. X          turn_off(sw);
  1729. X          off_action(sw);
  1730. X          }
  1731. X+     }
  1732. X+ 
  1733. X+ 
  1734. X+ /* change active switch - used for some right-button functions */
  1735. X+ static turn_off_old_switch(sw)
  1736. X+ F_switch    *sw;
  1737. X+ {
  1738. X+     F_switch    *old;
  1739. X+     old = group[sw->group];
  1740. X+     if (old != sw && old) 
  1741. X+     { turn_off(old);
  1742. X+       off_action(old);
  1743. X+     }
  1744. X+ }
  1745. X+ 
  1746. X+ 
  1747. X+ show_zoomscale()
  1748. X+     {
  1749. X+     /* write the font size in the background pixmap */
  1750. X+     tmpsiz[0]=tmpsiz[1]=tmpsiz[2]=tmpsiz[3]=tmpsiz[4]='\0';
  1751. X+     sprintf(tmpsiz,"%1d",zoomscale);
  1752. X+     /* put zoom scale number in normal and inverted pixmap */
  1753. X+     XDrawImageString(tool_d, zoom_sw->but.normal, button_gc, 
  1754. X+             2, 25, tmpsiz, strlen(tmpsiz));
  1755. X+     XDrawImageString(tool_d, zoom_sw->but.reverse, button_gc, 
  1756. X+             2, 25, tmpsiz, strlen(tmpsiz));
  1757. X+ 
  1758. X+     /* Fool the toolkit by changing the background pixmap to 0
  1759. X+        then giving it the modified one again.  Otherwise, it sees
  1760. X+        that the pixmap ID is not changed and doesn't actually draw
  1761. X+        it into the widget window */
  1762. X+     button_args[3].value = 0;
  1763. X+     XtSetValues(zoom_widget, &button_args[3], 1);
  1764. X+ 
  1765. X+     /* put the pixmap in the widget background */
  1766. X+     button_args[3].value = 
  1767. X+        zoom_sw->on ? zoom_sw->but.reverse : zoom_sw->but.normal;
  1768. X+     XtSetValues(zoom_widget, &button_args[3], 1);
  1769. X      }
  1770. X*** @xfig.pl9/xtra.c    Mon Jun  4 15:48:36 1990
  1771. X--- xtra.c    Fri Jun 14 10:44:30 1991
  1772. X***************
  1773. X*** 12,17 ****
  1774. X--- 12,18 ----
  1775. X  #include "paintop.h"
  1776. X  #include "font.h"
  1777. X  #include "object.h"
  1778. X+ #include "zoom.h"
  1779. X  
  1780. X  extern int        gc_thickness[0x10], gc_line_style[0x10];
  1781. X  
  1782. X***************
  1783. X*** 31,37 ****
  1784. X          gc_font[op] = font;
  1785. X          gc_fontsize[op] = size;
  1786. X          }
  1787. X!     XDrawString(tool_d, w, gccache[op], x, y, string, strlen(string));
  1788. X      }
  1789. X  
  1790. X  pr_size 
  1791. X--- 32,38 ----
  1792. X          gc_font[op] = font;
  1793. X          gc_fontsize[op] = size;
  1794. X          }
  1795. X!     zXDrawString(tool_d, w, gccache[op], x, y, string, strlen(string));
  1796. X      }
  1797. X  
  1798. X  pr_size 
  1799. X***************
  1800. X*** 46,52 ****
  1801. X      canvas_font = lookfont(font,size);    /* make sure it is the right font */
  1802. X      XTextExtents(canvas_font, s, n, &dummy, &dummy, &dummy, &ch);
  1803. X      ret.x = ch.width;
  1804. X!     ret.y = ch.ascent + ch.descent;
  1805. X      return (ret);
  1806. X      }
  1807. X  
  1808. X--- 47,53 ----
  1809. X      canvas_font = lookfont(font,size);    /* make sure it is the right font */
  1810. X      XTextExtents(canvas_font, s, n, &dummy, &dummy, &dummy, &ch);
  1811. X      ret.x = ch.width;
  1812. X!     ret.y = (ch.ascent + ch.descent);
  1813. X      return (ret);
  1814. X      }
  1815. X  
  1816. X***************
  1817. X*** 380,386 ****
  1818. X      if (line_width == 0)
  1819. X          return;
  1820. X      set_line_stuff(line_width,line_style,style_val,op);
  1821. X!     XDrawLine(tool_d, w, gccache[op], x1, y1, x2, y2);
  1822. X      }
  1823. X  
  1824. X  pw_lines(w, points, npoints, op, line_width, line_style, style_val, area_fill)
  1825. X--- 381,390 ----
  1826. X      if (line_width == 0)
  1827. X          return;
  1828. X      set_line_stuff(line_width,line_style,style_val,op);
  1829. X!     if (line_style==PANEL_LINE)
  1830. X!         XDrawLine(tool_d, w, gccache[op], x1, y1, x2, y2);
  1831. X!     else
  1832. X!         zXDrawLine(tool_d, w, gccache[op], x1, y1, x2, y2);
  1833. X      }
  1834. X  
  1835. X  pw_lines(w, points, npoints, op, line_width, line_style, style_val, area_fill)
  1836. X***************
  1837. X*** 399,411 ****
  1838. X              gc = fill_gc[area_fill-1];
  1839. X          else
  1840. X              gc = un_fill_gc[area_fill-1];
  1841. X!         XFillPolygon(tool_d, w, gc, points, npoints,
  1842. X              Complex, CoordModeOrigin);
  1843. X          }
  1844. X      if (line_width == 0)
  1845. X          return;
  1846. X      set_line_stuff(line_width, line_style, style_val, op);
  1847. X!     XDrawLines(tool_d, w, gccache[op], points, npoints, CoordModeOrigin);
  1848. X      }
  1849. X  
  1850. X  set_line_stuff(width,style,style_val,op)
  1851. X--- 403,422 ----
  1852. X              gc = fill_gc[area_fill-1];
  1853. X          else
  1854. X              gc = un_fill_gc[area_fill-1];
  1855. X!             if (line_style==PANEL_LINE)
  1856. X!             XFillPolygon(tool_d, w, gc, points, npoints,
  1857. X              Complex, CoordModeOrigin);
  1858. X+         else
  1859. X+             zXFillPolygon(tool_d, w, gc, points, npoints,
  1860. X+             Complex, CoordModeOrigin);
  1861. X          }
  1862. X      if (line_width == 0)
  1863. X          return;
  1864. X      set_line_stuff(line_width, line_style, style_val, op);
  1865. X!     if (line_style==PANEL_LINE)
  1866. X!         XDrawLines(tool_d, w, gccache[op], points, npoints, CoordModeOrigin);
  1867. X!     else
  1868. X!         zXDrawLines(tool_d, w, gccache[op], points, npoints, CoordModeOrigin);
  1869. X      }
  1870. X  
  1871. X  set_line_stuff(width,style,style_val,op)
  1872. X***************
  1873. X*** 414,437 ****
  1874. X      {
  1875. X      XGCValues gcv;
  1876. X      unsigned long mask;
  1877. X!     char dash_list[2];
  1878. X  
  1879. X!     if (width == gc_thickness[op] && style == gc_line_style[op])
  1880. X!         return;
  1881. X!     gcv.line_width = (width == 1? 0: width); /* use 0 width for 1 (much faster) */
  1882. X!     mask = GCLineWidth|GCLineStyle;
  1883. X!     gcv.line_style = (style==SOLID_LINE)? LineSolid: LineOnOffDash;
  1884. X!     if (style==SOLID_LINE)
  1885. X!         XChangeGC(tool_d, gccache[op], mask, &gcv);
  1886. X!     else
  1887. X          {
  1888. X-         mask |= GCDashList;
  1889. X          if (style_val > 0.0)    /* style_val of 0.0 causes problems */
  1890. X          {
  1891. X-         gcv.dashes = (char) style_val;
  1892. X-         XChangeGC(tool_d, gccache[op], mask, &gcv);
  1893. X          /* length of ON/OFF pixels */
  1894. X!         dash_list[0]=dash_list[1] = (char) style_val;
  1895. X          if (style == DOTTED_LINE)
  1896. X              dash_list[0] = 1;    /* length of ON pixels for dotted */
  1897. X          XSetDashes(tool_d, gccache[op], 0, dash_list, 2);
  1898. X--- 425,460 ----
  1899. X      {
  1900. X      XGCValues gcv;
  1901. X      unsigned long mask;
  1902. X!     static char dash_list[2]={-1,-1};
  1903. X  
  1904. X!     switch(style)
  1905. X!     { case RUBBER_LINE: width=1;
  1906. X!                 break;
  1907. X!       case PANEL_LINE: break;
  1908. X!       default: width=zoomscale*width;
  1909. X!            break;
  1910. X!     }
  1911. X! 
  1912. X!     /* see if all gc stuff is already correct */
  1913. X!     if (width == gc_thickness[op] && style == gc_line_style[op] && 
  1914. X!         (style!=DASH_LINE && style!=DOTTED_LINE || 
  1915. X!          dash_list[1]==(char)style_val*zoomscale ) ) 
  1916. X!              return;    /* yes, no need to change it */
  1917. X! 
  1918. X!     /* can't use linewidth 0 when setting dashed lines! */
  1919. X!         gcv.line_width=width;
  1920. X! 
  1921. X!     mask = GCLineWidth|GCLineStyle|GCCapStyle;
  1922. X!     gcv.line_style = (style==DASH_LINE || style==DOTTED_LINE)?
  1923. X!               LineOnOffDash : LineSolid;
  1924. X!     gcv.cap_style= (style==DOTTED_LINE)? CapRound : CapButt;
  1925. X!     XChangeGC(tool_d, gccache[op], mask, &gcv);
  1926. X!     if (style==DASH_LINE || style==DOTTED_LINE)
  1927. X          {
  1928. X          if (style_val > 0.0)    /* style_val of 0.0 causes problems */
  1929. X          {
  1930. X          /* length of ON/OFF pixels */
  1931. X!         dash_list[0]=dash_list[1] = (char) style_val*zoomscale;
  1932. X          if (style == DOTTED_LINE)
  1933. X              dash_list[0] = 1;    /* length of ON pixels for dotted */
  1934. X          XSetDashes(tool_d, gccache[op], 0, dash_list, 2);
  1935. END_OF_FILE
  1936. if test 53127 -ne `wc -c <'patch10.4'`; then
  1937.     echo shar: \"'patch10.4'\" unpacked with wrong size!
  1938. fi
  1939. # end of 'patch10.4'
  1940. fi
  1941. echo shar: End of archive 4 \(of 4\).
  1942. cp /dev/null ark4isdone
  1943. MISSING=""
  1944. for I in 1 2 3 4 ; do
  1945.     if test ! -f ark${I}isdone ; then
  1946.     MISSING="${MISSING} ${I}"
  1947.     fi
  1948. done
  1949. if test "${MISSING}" = "" ; then
  1950.     echo You have unpacked all 4 archives.
  1951.     rm -f ark[1-9]isdone
  1952. else
  1953.     echo You still need to unpack the following archives:
  1954.     echo "        " ${MISSING}
  1955. fi
  1956. ##  End of shell archive.
  1957. exit 0
  1958.  
  1959. --
  1960. Dan Heller
  1961. O'Reilly && Associates       Z-Code Software    Comp-sources-x:
  1962. Senior Writer                President          comp-sources-x@uunet.uu.net
  1963. argv@ora.com                 argv@zipcode.com
  1964.